export default {
  data () {
    return {
      pickerOptions: {
        shortcuts: [
          {
            text: '最近一周',
            onClick (picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
              picker.$emit('pick', [start, end], true)
            },
          },
          {
            text: '最近一个月',
            onClick (picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
              picker.$emit('pick', [start, end], true)
            },
          },
          {
            text: '最近三个月',
            onClick (picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
              picker.$emit('pick', [start, end], true)
            },
          },
        ],
      },
      dateValue: [
        new Date(new Date().getTime() - 3600 * 24 * 1000 * 7),
        new Date(),
      ],
      typeOptions: [
        {
          value: 0,
          label: '客流量',
        },
        {
          value: 1,
          label: '车流量',
        },
      ],
      typeValue: 0
    }
  },
  methods: {
    //将一个日期类数组转化为yyyy-MM-dd hh:mm:ss格式
    convertDateToStr (date) {
      return date.map((item) => {
        return item.format('yyyy-MM-dd hh:mm:ss')
      })
    }
  },
}
